//
//  NSThread+Extension.m
//  runloop让线程保活
//
//  Created by Hello Cai on 2021/7/26.
//

#import "NSThread+Extension.h"

@implementation NSThread (Extension)

-(instancetype)hr_initWithBlock:(void (^)(void))block{
    void (^inBlock)(void) = [block copy];
    NSThread *thread = [[NSThread alloc] initWithTarget:self selector:@selector(task:) object:inBlock];
    return thread;
}

-(void)task:(void (^)(void))block{
    if(block)
    {
        block();
    }
}

@end
